package com.web.controller;

import com.web.bean.学生情况;
import com.web.dao.学生情况Dao;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

//定义当前请求处理的访问uri
@WebServlet("/toUpdateStudent")
public class StudentToUpdateController extends HttpServlet {


    @Override           //req请求对象                           resp响应对象
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        req.setCharacterEncoding("UTF-8");

        String sid = req.getParameter("学号");


        学生情况Dao dao = new 学生情况Dao();
        学生情况 student = dao.queryStudentById(sid);

        req.setAttribute("updateStudent",student);
        req.getRequestDispatcher("/StudentUpdate.jsp").forward(req, resp);


    }


    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req, resp);
    }
}